Private Sub Command1_Click()

' This script demonstrates how to add a LayerSet
' and then duplicate the top layer and place it into
' the Layer Set.

Dim appRef As Photoshop.Application
Dim docRef As Photoshop.Document
Dim layerRef As Photoshop.ArtLayer
Dim layerSetRef As Photoshop.LayerSet

Set appRef = CreateObject("Photoshop.Application")

If (appRef.Documents.Count > 0) Then

    Set docRef = appRef.ActiveDocument
    Set layerSetRef = docRef.LayerSets.Add
    Set layerRef = docRef.ArtLayers(1).Duplicate
    layerRef.MoveToEnd layerSetRef
    
Else
    MsgBox ("You must have at least one open document to run this script")
End If

End Sub
